package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchDailyPressureQualifiedRateReports;
import com.ruoyi.system.service.IDispatchDailyPressureQualifiedRateReportsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 压力合格率日报Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchDailyPressureQualifiedRateReports")
public class DispatchDailyPressureQualifiedRateReportsController extends BaseController
{
    @Autowired
    private IDispatchDailyPressureQualifiedRateReportsService dispatchDailyPressureQualifiedRateReportsService;

    /**
     * 查询压力合格率日报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchDailyPressureQualifiedRateReports dispatchDailyPressureQualifiedRateReports)
    {
        startPage();
        List<DispatchDailyPressureQualifiedRateReports> list = dispatchDailyPressureQualifiedRateReportsService.selectDispatchDailyPressureQualifiedRateReportsList(dispatchDailyPressureQualifiedRateReports);
        return getDataTable(list);
    }

    /**
     * 导出压力合格率日报列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:export')")
    @Log(title = "压力合格率日报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchDailyPressureQualifiedRateReports dispatchDailyPressureQualifiedRateReports)
    {
        List<DispatchDailyPressureQualifiedRateReports> list = dispatchDailyPressureQualifiedRateReportsService.selectDispatchDailyPressureQualifiedRateReportsList(dispatchDailyPressureQualifiedRateReports);
        ExcelUtil<DispatchDailyPressureQualifiedRateReports> util = new ExcelUtil<DispatchDailyPressureQualifiedRateReports>(DispatchDailyPressureQualifiedRateReports.class);
        util.exportExcel(response, list, "压力合格率日报数据");
    }

    /**
     * 获取压力合格率日报详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:query')")
    @GetMapping(value = "/{dailyPressureQualifiedRateReportsId}")
    public AjaxResult getInfo(@PathVariable("dailyPressureQualifiedRateReportsId") Long dailyPressureQualifiedRateReportsId)
    {
        return success(dispatchDailyPressureQualifiedRateReportsService.selectDispatchDailyPressureQualifiedRateReportsByDailyPressureQualifiedRateReportsId(dailyPressureQualifiedRateReportsId));
    }

    /**
     * 新增压力合格率日报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:add')")
    @Log(title = "压力合格率日报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchDailyPressureQualifiedRateReports dispatchDailyPressureQualifiedRateReports)
    {
        return toAjax(dispatchDailyPressureQualifiedRateReportsService.insertDispatchDailyPressureQualifiedRateReports(dispatchDailyPressureQualifiedRateReports));
    }

    /**
     * 修改压力合格率日报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:edit')")
    @Log(title = "压力合格率日报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchDailyPressureQualifiedRateReports dispatchDailyPressureQualifiedRateReports)
    {
        return toAjax(dispatchDailyPressureQualifiedRateReportsService.updateDispatchDailyPressureQualifiedRateReports(dispatchDailyPressureQualifiedRateReports));
    }

    /**
     * 删除压力合格率日报
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchDailyPressureQualifiedRateReports:remove')")
    @Log(title = "压力合格率日报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dailyPressureQualifiedRateReportsIds}")
    public AjaxResult remove(@PathVariable Long[] dailyPressureQualifiedRateReportsIds)
    {
        return toAjax(dispatchDailyPressureQualifiedRateReportsService.deleteDispatchDailyPressureQualifiedRateReportsByDailyPressureQualifiedRateReportsIds(dailyPressureQualifiedRateReportsIds));
    }
}
